﻿using System;
using System.Collections.Generic;
using Manager;
using UnityEngine;

// Token: 0x02000259 RID: 601
public abstract class CharCustom
{
	// Token: 0x06000E06 RID: 3590 RVA: 0x000635D0 File Offset: 0x000617D0
	public CharCustom(global::CharInfo info, int sfnum, int sbnum)
	{
		this.chaInfo = info;
		this.chaFile = this.chaInfo.chaFile;
		this.customInfo = this.chaInfo.customInfo;
		this.ShapeFaceNum = sfnum;
		this.ShapeBodyNum = sbnum;
	}

	// Token: 0x06000E07 RID: 3591 RVA: 0x00063624 File Offset: 0x00061824
	public void ChangeMaterial(ref int id, Dictionary<int, global::ListTypeMaterial> dictMat, global::CharReference.TagObjKey key)
	{
		global::ListTypeMaterial listTypeMaterial = null;
		if (!dictMat.TryGetValue(id, out listTypeMaterial))
		{
			if (id == 0)
			{
				return;
			}
			if (!dictMat.TryGetValue(0, out listTypeMaterial))
			{
				return;
			}
			id = 0;
		}
		Material material = global::CommonLib.LoadAsset<Material>(listTypeMaterial.ABPath, listTypeMaterial.MatName, true, listTypeMaterial.Manifest);
		global::Singleton<Manager.Character>.Instance.AddLoadAssetBundle(listTypeMaterial.ABPath);
		List<GameObject> tagInfo = this.chaInfo.GetTagInfo(key);
		for (int i = 0; i < tagInfo.Count; i++)
		{
			if (!(null == tagInfo[i]))
			{
				tagInfo[i].GetComponent<Renderer>().material = material;
			}
		}
	}

	// Token: 0x06000E08 RID: 3592 RVA: 0x000636D4 File Offset: 0x000618D4
	public global::ListTypeTexture LoatTextureInfoBase(Dictionary<int, global::ListTypeTexture> dictTex, ref int id, ref Texture2D diffuse, ref Texture normal, ref Texture detail)
	{
		global::ListTypeTexture listTypeTexture = null;
		if (!dictTex.TryGetValue(id, out listTypeTexture))
		{
			if (id == 0)
			{
				global::Debug.LogWarning("テクスチャのIDがない");
				return listTypeTexture;
			}
			if (!dictTex.TryGetValue(0, out listTypeTexture))
			{
				return listTypeTexture;
			}
			id = 0;
		}
		diffuse = null;
		normal = null;
		detail = null;
		if ("0" != listTypeTexture.TexDiffuse)
		{
			diffuse = global::CommonLib.LoadAsset<Texture2D>(listTypeTexture.ABPath, listTypeTexture.TexDiffuse, false, string.Empty);
		}
		if ("0" != listTypeTexture.TexNormal)
		{
			normal = global::CommonLib.LoadAsset<Texture>(listTypeTexture.ABPath, listTypeTexture.TexNormal, false, string.Empty);
		}
		if ("0" != listTypeTexture.TexDetail)
		{
			detail = global::CommonLib.LoadAsset<Texture>(listTypeTexture.ABPath, listTypeTexture.TexDetail, false, string.Empty);
		}
		global::Singleton<Manager.Character>.Instance.AddLoadAssetBundle(listTypeTexture.ABPath);
		return listTypeTexture;
	}

	// Token: 0x06000E09 RID: 3593 RVA: 0x000637C0 File Offset: 0x000619C0
	public bool SetFaceBaseMaterial()
	{
		Material customMatFace = this.chaInfo.chaBody.customMatFace;
		return !(null == customMatFace) && this.SetBaseMaterial(global::CharReference.TagObjKey.ObjSkinFace, customMatFace);
	}

	// Token: 0x06000E0A RID: 3594 RVA: 0x000637F4 File Offset: 0x000619F4
	public bool SetBodyBaseMaterial()
	{
		Material customMatBody = this.chaInfo.chaBody.customMatBody;
		return !(null == customMatBody) && this.SetBaseMaterial(global::CharReference.TagObjKey.ObjSkinBody, customMatBody);
	}

	// Token: 0x06000E0B RID: 3595 RVA: 0x0006382C File Offset: 0x00061A2C
	public bool SetBaseMaterial(global::CharReference.TagObjKey tagKey, Material mat)
	{
		if (null == mat)
		{
			return false;
		}
		List<GameObject> tagInfo = this.chaInfo.GetTagInfo(tagKey);
		if (tagInfo.Count == 0)
		{
			return false;
		}
		int num = tagInfo[0].GetComponent<Renderer>().materials.Length;
		Material[] array;
		if (num == 0)
		{
			array = new Material[]
			{
				mat
			};
		}
		else
		{
			array = new Material[num];
			for (int i = 0; i < num; i++)
			{
				array[i] = tagInfo[0].GetComponent<Renderer>().materials[i];
			}
			Material material = array[0];
			array[0] = mat;
			if (material != mat)
			{
				UnityEngine.Object.Destroy(material);
			}
		}
		for (int j = 0; j < tagInfo.Count; j++)
		{
			if (!(null == tagInfo[j]))
			{
				tagInfo[j].GetComponent<Renderer>().materials = array;
			}
		}
		return true;
	}

	// Token: 0x06000E0C RID: 3596
	public abstract bool InitShapeFace(Transform trfBone, string assetBundleAnmShapeFace, string assetAnmShapeFace);

	// Token: 0x06000E0D RID: 3597 RVA: 0x00063920 File Offset: 0x00061B20
	public void ReleaseShapeFace()
	{
		if (this.sibFace == null)
		{
			return;
		}
		this.sibFace.ReleaseShapeInfo();
	}

	// Token: 0x06000E0E RID: 3598 RVA: 0x0006393C File Offset: 0x00061B3C
	public bool SetShapeFaceValue(int index, float value)
	{
		if (index >= this.ShapeFaceNum)
		{
			return false;
		}
		this.customInfo.shapeValueFace[index] = value;
		if (this.sibFace != null && this.sibFace.InitEnd)
		{
			this.sibFace.ChangeValue(index, value);
		}
		this.chaInfo.chaBody.updateShapeFace = true;
		return true;
	}

	// Token: 0x06000E0F RID: 3599 RVA: 0x000639A0 File Offset: 0x00061BA0
	public bool UpdateShapeFaceValueFromCustomInfo()
	{
		if (this.sibFace == null || !this.sibFace.InitEnd)
		{
			return false;
		}
		for (int i = 0; i < this.customInfo.shapeValueFace.Length; i++)
		{
			this.sibFace.ChangeValue(i, this.customInfo.shapeValueFace[i]);
		}
		this.chaInfo.chaBody.updateShapeFace = true;
		return true;
	}

	// Token: 0x06000E10 RID: 3600 RVA: 0x00063A14 File Offset: 0x00061C14
	public float GetShapeFaceValue(int index)
	{
		if (index >= this.ShapeFaceNum)
		{
			return 0f;
		}
		return this.customInfo.shapeValueFace[index];
	}

	// Token: 0x06000E11 RID: 3601 RVA: 0x00063A38 File Offset: 0x00061C38
	public void UpdateShapeFace()
	{
		if (this.sibFace == null || !this.sibFace.InitEnd)
		{
			return;
		}
		int[] array = new int[]
		{
			55,
			56,
			57,
			58
		};
		if (this.chaInfo.statusInfo.disableShapeMouth)
		{
			for (int i = 0; i < array.Length; i++)
			{
				this.sibFace.ChangeValue(array[i], 0.5f);
			}
		}
		else
		{
			for (int j = 0; j < array.Length; j++)
			{
				this.sibFace.ChangeValue(array[j], this.customInfo.shapeValueFace[array[j]]);
			}
		}
		this.sibFace.Update();
	}

	// Token: 0x06000E12 RID: 3602
	public abstract bool InitShapeBody(Transform trfBone);

	// Token: 0x06000E13 RID: 3603 RVA: 0x00063AF4 File Offset: 0x00061CF4
	public void ReleaseShapeBody()
	{
		if (this.sibBody == null)
		{
			return;
		}
		this.sibBody.ReleaseShapeInfo();
	}

	// Token: 0x06000E14 RID: 3604
	public abstract bool SetShapeBodyValue(int index, float value);

	// Token: 0x06000E15 RID: 3605 RVA: 0x00063B10 File Offset: 0x00061D10
	public bool UpdateShapeBodyValueFromCustomInfo()
	{
		if (this.sibBody == null || !this.sibBody.InitEnd)
		{
			return false;
		}
		for (int i = 0; i < this.customInfo.shapeValueBody.Length; i++)
		{
			this.sibBody.ChangeValue(i, this.customInfo.shapeValueBody[i]);
		}
		this.chaInfo.chaBody.updateShapeBody = true;
		return true;
	}

	// Token: 0x06000E16 RID: 3606
	public abstract float GetShapeBodyValue(int index);

	// Token: 0x06000E17 RID: 3607
	public abstract void UpdateShapeBody();

	// Token: 0x06000E18 RID: 3608 RVA: 0x00063B84 File Offset: 0x00061D84
	public void DisableShapeMouth()
	{
		this.chaInfo.chaBody.updateShapeFace = true;
		this.chaInfo.statusInfo.disableShapeMouth = true;
	}

	// Token: 0x06000E19 RID: 3609 RVA: 0x00063BA8 File Offset: 0x00061DA8
	public void EnableShapeMouth()
	{
		this.chaInfo.chaBody.updateShapeFace = true;
		this.chaInfo.statusInfo.disableShapeMouth = false;
	}

	// Token: 0x06000E1A RID: 3610
	public abstract void ChangeHairColor(int parts);

	// Token: 0x06000E1B RID: 3611
	public abstract void ChangeHairColor(int parts, global::HSColorSet color);

	// Token: 0x06000E1C RID: 3612
	public abstract void ChangeHairAcsColor(int parts);

	// Token: 0x06000E1D RID: 3613
	public abstract void ChangeHairAcsColor(int parts, global::HSColorSet color);

	// Token: 0x06000E1E RID: 3614
	public abstract void UpdateAllCustom();

	// Token: 0x06000E1F RID: 3615
	public abstract void ChangeCustomFaceWithoutCustomTexture();

	// Token: 0x06000E20 RID: 3616
	public abstract void ChangeCustomBodyWithoutCustomTexture();

	// Token: 0x06000E21 RID: 3617
	public abstract void ChangeEyebrow();

	// Token: 0x06000E22 RID: 3618
	public abstract void ChangeEyebrowColor();

	// Token: 0x06000E23 RID: 3619
	public abstract void ChangeEyeWColor();

	// Token: 0x06000E24 RID: 3620
	public abstract void ChangeEyeL();

	// Token: 0x06000E25 RID: 3621
	public abstract void ChangeEyeLColor();

	// Token: 0x06000E26 RID: 3622
	public abstract void ChangeEyeR();

	// Token: 0x06000E27 RID: 3623
	public abstract void ChangeEyeRColor();

	// Token: 0x04000F06 RID: 3846
	public global::CharInfo chaInfo;

	// Token: 0x04000F07 RID: 3847
	public global::CharFile chaFile;

	// Token: 0x04000F08 RID: 3848
	public global::CharFileInfoCustom customInfo;

	// Token: 0x04000F09 RID: 3849
	public global::ShapeInfoBase sibFace;

	// Token: 0x04000F0A RID: 3850
	public global::ShapeInfoBase sibBody;

	// Token: 0x04000F0B RID: 3851
	public readonly int ShapeFaceNum;

	// Token: 0x04000F0C RID: 3852
	public readonly int ShapeBodyNum;

	// Token: 0x04000F0D RID: 3853
	public bool releaseCustomInputTexture = true;

	// Token: 0x04000F0E RID: 3854
	static int WIDESLIDER_080;
}
